﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <%= TempData["Message"]%>
    <div id="cactionbutton">
        <button type="button" id="btnRefesh" title="Refesh" class="button refresh">
            Làm mới</button>
        <button type="button" id="btnDelete" title="Delete" class="button delete">
            Xóa</button>
        <button type="button" id="btnAddnew" title="Refesh" class="button addnew">
            Tạo mới</button>
    </div>
    <div id="cfilter">
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <input type="text" id="txtKeyword" maxlength="200" value="<%= Constants.PARTNER_NAME%>"
                        onfocus="ShowOnFocus(this,'<%= Constants.PARTNER_NAME  %>')" onblur="ShowOnBlur(this,'<%= Constants.PARTNER_NAME  %>')" />
                </td>
                <td>
                    <%=Html.DropDownList(CommonDataKey.CATEGORY, ViewData[CommonDataKey.CATEGORY] as SelectList, Constants.CATEGORY_FIRST_ITEM, new { @style = "width:180px" })%>
                </td>
                <td>
                    Ngày hết hạn  từ
                </td>
                <td>
                    <%=Html.DatePicker("ExpireDateFrom", new { @maxlength = "10", @style = "width:100px" })%>
                </td>
                <td>
                    Đến
                </td>
                <td>
                    <%=Html.DatePicker("ExpireDateTo", new { @maxlength = "10", @style = "width:100px" })%>
                </td>                
                <td>
                    <select style="width: 180px;" name="Expired" id="Expired"><option value="">Tất cả đối tác</option>
                        <option value="true">Đối tác hết hạn</option>
                    </select>
                </td>
                <td>
                    <button type="button" id="btnFilter" title="Filter" class="button filter">
                        Lọc</button>
                </td>
            </tr>
        </table>
    </div>
    <div class="clist">
        <table id="list" class="scroll">
        </table>
        <div id="pager" class="scroll" style="text-align: center;">
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageTitle" runat="server">
    Thẻ sinh viên - Đối tác
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <script src="/Scripts/jquery.validate.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#txtKeyword").autocomplete('/Library/GenericHandle/AutoCompleteHandler.ashx/?Page=Partner');
            jQuery("#list").jqGrid({
                url: '/Partner/GetListJQGrid/?name=' + encodeURIComponent($("#txtKeyword").val()) + '&catId=' + encodeURIComponent($("#<%=CommonDataKey.CATEGORY%>").val()) + '&fromdate=' + $('#ExpireDateFrom').val() + '&todate=' + $('#ExpireDateTo').val() + '&expired=' + $('#Expired').val(),
                datatype: 'json',
                mtype: 'GET',
                colNames: ['ID', 'Logo', 'Tên Đối Tác', 'Loại Đối Tác', 'Đối Tác Mới', 'Kích Hoạt', 'Thứ Tự', 'Ngày Tạo', 'Ngày Cập Nhật', 'Ngày Hết Hạn', 'Chức Năng'],
                colModel: [
                  { name: 'ID', index: 'ID', align: "center", width: 50, hidden: true },
                  { name: 'Logo', index: 'Logo', align: "center", width: 60, sortable: true },
                  { name: 'PartnerName', index: 'PartnerName', align: "left", width: 100, sortable: true },
                  { name: 'Category', index: 'Category', align: "left", width: 100, sortable: true },
                  { name: 'NewPartner', index: 'NewPartner', align: "center", width: 40, sortable: false },
                  { name: 'Active', index: 'Active', align: "center", width: 40, sortable: false },
                  { name: 'PartnerOrder', index: 'PartnerOrder', align: "center", width: 40, sortable: true },
                  { name: 'CreateDate', index: 'CreateDate', align: "center", width: 45, sortable: true },
                  { name: 'UpdateDate', index: 'UpdateDate', align: "center", width: 45, sortable: true },
                  { name: 'ExpireDate', index: 'ExpireDate', align: "center", width: 45, sortable: true },
                  { name: 'Action', index: 'Action', editable: false, width: 50, align: 'center', sortable: false}],
                pager: jQuery('#pager'),
                rowList: [20, 30, 50, 100, 200],
                sortname: 'PartnerOrder',
                sortorder: "desc",
                multiselect: true,
                viewrecords: true,
                width: 1200, height: "100%",
                imgpath: '/scripts/grid/themes/basic/images',
                loadui: 'block'
            });
            JS_LIB.onEnterKeyword();
            $("#btnRefesh").click(function () {
                window.location = "/Administration/Partner/Index";
            });
            $("#btnAddnew").click(function () {
                JS_LIB.redirect('/Administration/Partner/Create');
            });
            $("#btnDelete").click(function () {
                JS_LIB.deletes('#list', 'ID', '/Administration/Partner/DeleteList');
            });
            $("#btnFilter").click(function () {
                $('#list').setGridParam({ url: '/Administration/Partner/GetListJQGrid?name=' + encodeURIComponent($('#txtKeyword').val()) + '&catId=' + encodeURIComponent($("#<%=CommonDataKey.CATEGORY%>").val()) + '&fromdate=' + $('#ExpireDateFrom').val() + '&todate=' + $('#ExpireDateTo').val() + '&expired=' + $('#Expired').val() });
                $("#list").trigger('reloadGrid');
            });
        });
    </script>
    <style type="text/css">
        .ui-jqgrid tr.jqgrow td
        {
            white-space: normal;
        }
    </style>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ModuleName" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="FunctionTitle" runat="server">
    Đối Tác
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="LoginRoles" runat="server">
</asp:Content>
